<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<link rel="stylesheet" href="css/common.css" type="text/css" />
<title>管理区域</title>
<script language="javascript" type="text/javascript" src="My97DatePicker/WdatePicker.js"></script>
<link href="css/ui-lightness/jquery-ui-1.10.3.custom.min.css" rel="stylesheet" type="text/css">
<script  language="javascript" type="text/javascript" src="js/jquery-1.9.1.min.js"></script>
<script   language="javascript" type="text/javascript"src="js/jquery-ui-1.10.3.custom.js"></script>
</head>
<script>
$(function() {		
	$( "#tabs" ).tabs();
});
</script>
<script>
var select2 = new Array(<?=count($departmentList)?>);
<?
foreach($departmentList as $k=>$v){
?>
select2[<?=$k?>] = new Array();
select2[<?=$k?>][0] = new Option("请选择", "-1");
<?
foreach($homemade_producer_list[$k] as $k1=>$v1){
?>
	select2[<?=$k?>][<?=$k1+1?>] = new Option("<?=$v1['name']?>", "<?=$v1['id']?>");
<?
	}
}
?>
function redirec(x,dx,city){
	var temp = dx; 
	temp.options.length=0;
	for (i=0;i<select2[x].length;i++){
		temp.options[i]=new Option(select2[x][i].text,select2[x][i].value);
		if (city>0){
			if (select2[x][i].value==city){
				temp.options[i].selected=true;
			}
		}
	}
}
</script>
<body>
<div id="tabs">
	<ul>
		<li><a href="#tabs-1">基本信息</a></li>
		<li><a href="#tabs-2">其他信息</a></li>
</ul>
<div id="man_zone">
<div id="tabs-1">
 <form  method="post" action="<? if  (empty($id)){ echo  'course_subAdd.html'; }else{ echo  'course_subUpdate.html'; }  ?>" ><input name="id" type="hidden" value="<?=$id?>">
  <table width="99%" border="0" align="center"  cellpadding="3" cellspacing="1" class="table_style">
    <tr>
      <td class="left_title_1">主题</td>
      <td><input name="theme" type="text"  value="<?=getStr($extract_vars,'theme')?>"></td>
      <td  class="left_title_1">课程分类</td>
      <td>
      <select name="types">
        <option value="1" <?  if (getStr($extract_vars,'types')==1){ echo'selected="selected"'; } ?> >体验教材</option>
        <option value="2" <?  if (getStr($extract_vars,'types')==2){ echo'selected="selected"'; } ?> >课堂教材</option>
      	
      </select>
      </td>
      </tr>
      <tr>
      <td class="left_title_1">课程类别</td>
      <td><select name="type" >
      <?
      foreach ($course_types as $k=>$v){
	  ?>
        <option value="<?=$k?>" <?   if (getStr($extract_vars,'type')==$k){ echo 'selected="selected"'; }?>><?=$v?></option>
        <?
	  }
		?>
      </select></td>
      <td  class="left_title_1">编号</td>
      <td> <?
      if (!empty($id)){
		  echo $serial_number;
		  ?>
	  <input name="" type="hidden" value="<?=getStr($extract_vars,'serial_number')?>" />
	  <? }
	  else{
	  ?> <input name="serial_number" type="text" value="" id="serial_number"/>
      <?
	  }
	  ?></td>
      </tr>
      
        <tr>
      <td class="left_title_1">课时</td>
      <td><input name="class_hour" type="text"  value="<?=getStr($extract_vars,'class_hour',1) ?>"></td>
      <td  class="left_title_1">等级</td>
      <td>
      <select name="level">
   <?
   echo $levelOptions;
   ?>
      </select>
      </td>
      </tr>
      <tr>
      <td  class="left_title_1">状态</td>
      <td colspan="3">
      <select name="status">
      <?=$statusOptions?>
      </select>
      </td>
      </tr>      
      <tr style="display:none" >
      <td align="center" class="left_title_1" >来源</td>
      <td colspan="3" align="left" >
      <div><input name="source" type="radio"  value="<?=COURSE_HOMEMADE?>" <?  if (getStr($extract_vars,'source')==COURSE_HOMEMADE ||getStr($extract_vars,'source')=='' ){echo 'checked="checked"';} ?> />自制
		<input name="source" type="radio" value="<?=COURSE_BOOK?>" <?  if (getStr($extract_vars,'source')==COURSE_BOOK){echo 'checked="checked"';} ?> />书本</div>
      </td>
      </tr>
	  <tr id="tr_course_self" width:100%"  style="display:none">
	    <td class="left_title_1" id="td_course_sel_1" width="10%">制作时间</td>
	    <td width="40%"><input name="homemade_time" type="text"  onClick="WdatePicker()" value="<?=date('Y-m-d',getStr($extract_vars,'homemade_time',time()))?>" /> </td>
	    <td  class="left_title_1" width="10%">制作人</td>
	    <td width="40%">
		部门&nbsp;&nbsp;&nbsp;
      <select name="dept_id" id="dept_id"  onChange="redirec(this.value,document.getElementById('homemade_producer'))"   >
        <option value="-1">请选择</option>
          <?
          foreach ($departmentList as $k=>$v){
		  ?>
       	 <option value="<?=$k?>"  <?  if (isset($dept_id)){ if ($dept_id==$k){ echo 'selected="selected"';   } } ?> ><?=$v?></option>
       	 <?
		  }
		?>
      </select>
               员工&nbsp;&nbsp;&nbsp;<?php getStr($extract_vars,'homemade_producer')?>
      <select name="homemade_producer" id="homemade_producer" >
      </select>
      <script>
		<?
		if (!empty($dept_id)){?>
			redirec(document.getElementById('dept_id').value,document.getElementById('homemade_producer'),<?=getStr($extract_vars,'homemade_producer')?>);
		 <?	
		 }
		?>
	</script>
	    </td>
	  </tr>
	  <tr id="tr_course_public_1" style="display:none;width:100%">
	    <td class="left_title_1" id="td_course_public_1" width="10%">条形码</td>
	    <td><input name="book_barcode" value="<?=getStr($extract_vars,'book_barcode')?>" type="text" /></td>
	    <td class="left_title_1">出版商</td>
	    <td><input name="book_press" value="<?=getStr($extract_vars,'book_press')?>" type="text" /></td>
	  </tr>
	    <tr id="tr_course_public_2" style="display:none;width:100%">
	    <td class="left_title_1">版本</td>
	    <td><input name="book_version" value="<?=getStr($extract_vars,'book_version')?>" type="text" /></td>
	    <td class="left_title_1">时间</td>
	    <td>  <input name="book_time" type="text"  onClick="WdatePicker()" value="<?=date('Y-m-d',getStr($extract_vars,'book_time',time()))?>" /></td>
	  </tr>
	    <tr>
	      <td class="left_title_1">章节数</td>
	      <td><input name="book_chapter_number" value="<?=getStr($extract_vars,'book_chapter_number')?>" type="text" /></td>
	      <td>&nbsp;</td>
	      <td>&nbsp;</td>
	    </tr>
      </td>
      </tr>
      <tr>
      <td class="left_title_1" style="height:100px;">教材</td>
      <td colspan="3"><?=$teaching_material?></td>
      </tr>
</table>
</div>
<div  id="tabs-2">
<table cellpadding="0" cellspacing="0" class="table_style" align="center">
       <tr>
            <td  class="left_title_1">概述</td>
      		<td colspan="3"><textarea name="overview" cols="100" rows="10"><?=getStr($extract_vars,'overview')?></textarea></td>
      </tr>
       <tr>
      	<td class="left_title_1">描述</td>
      	<td colspan="3"><textarea name="describe" cols="100" rows="20"><?=getStr($extract_vars,'describe') ?></textarea></td>
      </tr>
  </table>
</div>
<div>
<table cellpadding="0" cellspacing="0" class="table_style" align="center">
    <tr>
      <td colspan="12" align="center" >
      <input name="" type="button" class="PublicBot" value="返回" onclick="window.history.go(-1);" />
        <input class="PublicBot" name="" type="submit" value="提交" />      </td>
    </tr>
</table>
</div>    
</form>
</div>
<script>
var source_id =<?=getStr($extract_vars, 'source')?>;
$(document).ready(
	    function()
	   {
		if(source_id=='1'){
			$("#tr_course_self").css("display",'none');
			$("#tr_course_public_1").css("display",'');
			$("#tr_course_public_2").css("display",'');
			$("#td_course_public_1").attr("width",'10%');
		}	
		if(source_id=='2'){
			$("#tr_course_public_1").css("display",'none');
			$("#tr_course_public_2").css("display",'none');
			$("#tr_course_self").css("display",'');
		}	
	   }
);
   
$("input:radio[name=source]").click(function(){
	if($('input:radio[name=source]:checked').val()=="1"){
		$("#tr_course_self").css("display",'none');
		$("#tr_course_public_1").css("display",'');
		$("#tr_course_public_2").css("display",'');
		$("#td_course_public_1").attr("width",'10%');
	};
	if($('input:radio[name=source]:checked').val()=="2"){
		$("#tr_course_public_1").css("display",'none');
		$("#tr_course_public_2").css("display",'none');
		$("#tr_course_self").css("display",'');
	};
})

</script>
</body>
</html>
